<%-- 
    Document   : db1
    Created on : 2014/8/19, 下午 01:26:13
    Author     : gjun
--%>

<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
    Class.forName("com.mysql.jdbc.Driver");//貼上資料庫路徑Driver/jdbc:mysq1.......
    Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/javadb", "root", "root");
    //Statement st=con.createStatement();
    String sql="insert into person (username , tel ,birthday ) values( ?,?,? )";
    java.sql.PreparedStatement ps=con.prepareStatement(sql);
    ps.setString(1, "LALA's rabbit");
    ps.setString(2, "02-345678");
    ps.setString(3, "8888/01/01");
    int x =ps.executeUpdate();
    //int x = st.executeUpdate(sql);
    //st.close();
    ps.close();
    con.close();


%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>db1</title>
    </head>
    <body>
        <h1>db1</h1>
        <%= x %>
    </body>
</html>
